﻿using cuyan.resume.analysis.Model;
using cuyan.resume.analysis.Utlis;

namespace cuyan.resume.analysis
{

    public class AnalysisTool
    {
        public string rootPath = Directory.GetCurrentDirectory();

        public AnalysisTool(string specialInformation = "", string specialInformation1 = "")
        {
            if (specialInformation != "")
            {
                this.specialInformation = specialInformation;
            }
            if (specialInformation1 != "")
            {
                this.specialInformation1 = specialInformation1;
            }

            SQLiteUtlis.CreateDB(rootPath + @"\ra.db");
        }


        string specialInformation = "教育经历,学习经历,自我评价,工作经历,项目经历,项目经验,社交主页,资格证书,教育/培训经历,培训经历,个人简介,自我介绍,个人评价";
        string specialInformation1 = "自我评价,个人简介,自我介绍,个人评价";


        List<string> jArrayORCResultall = new List<string>();

        /// <summary>
        /// 简历解析，固定版：解析出固定的字段，动态版暂时不支持，因为工作生活比较忙，没法去升级了。
        /// </summary>
        /// <param name="jArrayORCResult"></param>
        /// <returns></returns>
        public ResumeInfo ResumeAnalysisStart(List<string> jArrayORCResult)
        {
            ResumeInfo resumeInfo = new ResumeInfo();

            if (jArrayORCResult.Count() > 0)
            {

                // 过滤特殊信息
                if (true)
                {
                    // 去掉 PDF 转换的错误
                    if (jArrayORCResult[0].Contains("Evaluation Only.Created with Aspose.PDF"))
                    {
                        jArrayORCResult = jArrayORCResult.Where(a => !a.Contains("Evaluation Only.Created with Aspose.PDF")).ToList();
                    }
                    jArrayORCResult = jArrayORCResult.GroupBy(x => x).Select(x => x.First()).ToList();
                    jArrayORCResult = GetJLJX_CHList(jArrayORCResult, "1全局");
                }

                jArrayORCResultall = jArrayORCResult;
                List<string> result = new List<string>();

                //var jArrayORCResult = new List<Word>();


                List<string> allWord = new List<string>();

                List<string> nameAllFinds = new List<string>();
                List<string> genderAllFinds = new List<string>();
                List<string> ageAllFinds = new List<string>();
                List<string> heightAllFinds = new List<string>();
                List<string> weightAllFinds = new List<string>();
                List<string> maritalStatusAllFinds = new List<string>();
                List<string> birthdayAllFinds = new List<string>();
                List<string> HometownAddressAllFinds = new List<string>();
                List<string> HometownShortAddressAllFinds = new List<string>();
                List<string> IdentityCardsAllFinds = new List<string>();
                List<string> NationAllFinds = new List<string>();
                List<string> PoliticalOutlookAllFinds = new List<string>();
                List<string> LanguageAbilityAllFinds = new List<string>();
                List<string> EnglishLevelAllFinds = new List<string>();
                List<string> ComputerLevelAllFinds = new List<string>();
                List<string> BlogAllFinds = new List<string>();
                List<string> PhysicalConditionAllFinds = new List<string>();
                List<string> MajorAllFinds = new List<string>();
                List<string> DegreeNameFinds = new List<string>();
                List<string> GraduationSchoolAllFinds = new List<string>();
                List<string> HobbiesSpecialtiesAllFinds = new List<string>();
                List<string> SalaryRequirementsAllFinds = new List<string>();
                List<string> QQAllFinds = new List<string>();
                List<string> EMailAllFinds = new List<string>();
                List<string> PhoneAllFinds = new List<string>();


                // 循环识别出来的词汇
                for (int i = 0; i < jArrayORCResult.Count; i++)
                {
                    string item = jArrayORCResult[i];
                    if (item == "" || item == null || item.Replace(" ", "").Replace("\r", "").Replace("\n", "") == "")
                    {
                        item = "";
                    }
                    else
                    {
                        item = item.Trim();
                        if (item.Contains("Evaluation Only") || item.Contains("Aspose.PDF.") || item.Contains(" Aspose "))
                        {
                            continue;
                        }
                        if (i + 1 < jArrayORCResult.Count)
                        {
                            try
                            {
                                if (jArrayORCResult[i + 1].Contains("Evaluation Only") || jArrayORCResult[i + 1].Contains("Aspose.PDF."))
                                {
                                    continue;
                                }
                            }
                            catch (Exception)
                            {
                            }
                        }
                        allWord.Add(item.Replace("个大简历", "个人简历"));
                    }
                }
                allWord = GetJLJX_CHList(allWord, "全局");
                for (int i = 0; i < allWord.Count; i++)
                {
                    string? word = allWord[i];
                    nameAllFinds.AddRange(VerificationName(word, i));
                    genderAllFinds.AddRange(VerificationGender(word, i));
                    ageAllFinds.AddRange(VerificationAge(word, i));
                    heightAllFinds.AddRange(VerificationHeight(word, i));
                    weightAllFinds.AddRange(VerificationWeight(word, i));
                    maritalStatusAllFinds.AddRange(VerificationMaritalStatus(word, i));
                    birthdayAllFinds.AddRange(VerificationBirthday(word, i));
                    HometownAddressAllFinds.AddRange(VerificationHometownAddress(word, i));
                    HometownShortAddressAllFinds.AddRange(VerificationHometownShortAddress(word, i));
                    IdentityCardsAllFinds.AddRange(VerificationIdentityCards(word, i));
                    NationAllFinds.AddRange(VerificationNation(word, i));
                    PoliticalOutlookAllFinds.AddRange(VerificationPoliticalOutlook(word, i));
                    LanguageAbilityAllFinds.AddRange(VerificationLanguageAbility(word, i));
                    EnglishLevelAllFinds.AddRange(VerificationEnglishLevel(word, i));
                    ComputerLevelAllFinds.AddRange(VerificationComputerLevel(word, i));
                    BlogAllFinds.AddRange(VerificationBlog(word, i));
                    PhysicalConditionAllFinds.AddRange(VerificationPhysicalCondition(word, i));
                    MajorAllFinds.AddRange(VerificationMajor(word, i));
                    DegreeNameFinds.AddRange(VerificationDegreeName(word, i));
                    GraduationSchoolAllFinds.AddRange(VerificationGraduationSchool(word, i));
                    HobbiesSpecialtiesAllFinds.AddRange(VerificationHobbiesSpecialties(word, i));
                    SalaryRequirementsAllFinds.AddRange(VerificationSalaryRequirements(word, i));
                    QQAllFinds.AddRange(VerificationQQ(word, i));
                    EMailAllFinds.AddRange(VerificationEMail(word, i));
                    PhoneAllFinds.AddRange(VerificationPhone(word, i));


                    VerificationHometownAddress(word);
                    //Console.WriteLine(item);
                }
                resumeInfo.Name = GetName(nameAllFinds);
                JXLOG("姓名", GetName(nameAllFinds));
                resumeInfo.Sex = GetGender(genderAllFinds);
                JXLOG("性别", GetGender(genderAllFinds));

                JXLOG("年龄", GetAge(ageAllFinds));

                resumeInfo.Height = GetHight(heightAllFinds);
                JXLOG("身高", GetHight(heightAllFinds));

                resumeInfo.Weight = GetWeight(weightAllFinds);
                JXLOG("体重", GetWeight(weightAllFinds));

                resumeInfo.marriage = GetStatusAllFinds(maritalStatusAllFinds);
                JXLOG("婚姻状况", GetStatusAllFinds(maritalStatusAllFinds));
                birthdayAllFinds = GetJLJX_CHList(birthdayAllFinds, "出生日期");
                resumeInfo.Birthday = GetBirthday(birthdayAllFinds);
                if (resumeInfo.Birthday.Length > 4)
                {
                    if (resumeInfo.Birthday.Substring(0, 2) == "20")
                        if (resumeInfo.Birthday.Substring(0, 3) != "200")
                        {
                            resumeInfo.Birthday = "";
                        }
                }
                if (false)
                {
                    if (resumeInfo.Birthday.Length == 0)
                    {
                        if (ageAllFinds.Count() > 0)
                        {
                            var shuiStr = "";
                            foreach (var item in ageAllFinds)
                            {
                                if (item.Contains("岁"))
                                {
                                    for (int i = 1; i < item.IndexOf("岁"); i++)
                                    {
                                        if (item.IndexOf("岁") - i >= 0)
                                        {
                                            var we = item.Substring(item.IndexOf("岁") - i, 1);
                                            if (int.TryParse(we, out int shui))
                                            {
                                                shuiStr += shui;
                                            }
                                            else
                                            {
                                                if (shuiStr != "")
                                                {
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                if (shuiStr != "")
                                {
                                    break;
                                }
                            }
                            if (shuiStr != "")
                            {
                                resumeInfo.Birthday = DateTime.Now.AddYears(0 - int.Parse(shuiStr)).ToString("yyyy-MM-dd");
                            }
                        }
                    }
                }
                JXLOG("出生日期", GetBirthday(birthdayAllFinds));
                HometownShortAddressAllFinds = GetJLJX_CHList(HometownShortAddressAllFinds, "籍贯");
                resumeInfo.HomeName = GetHometownShortAddress(HometownShortAddressAllFinds);
                JXLOG("籍贯", GetHometownShortAddress(HometownShortAddressAllFinds));
                IdentityCardsAllFinds = GetJLJX_CHList(IdentityCardsAllFinds, "身份证");
                foreach (var IdentityCardsAllFindByOne in IdentityCardsAllFinds)
                {
                    if (System.Text.RegularExpressions.Regex.IsMatch(IdentityCardsAllFindByOne, @"(^\d{18}$)|(^\d{15}$)"))
                    {
                        resumeInfo.IdentityNumber = IdentityCardsAllFinds[0];
                        JXLOG("身份证", resumeInfo.IdentityNumber);
                        break;
                    }
                }
                NationAllFinds = GetJLJX_CHList(NationAllFinds, "民族");
                resumeInfo.NationName = GetNation(NationAllFinds);
                JXLOG("民族", GetNation(NationAllFinds));
                PhysicalConditionAllFinds = GetJLJX_CHList(PhysicalConditionAllFinds, "身体状况");
                resumeInfo.Health = GetPhysicalConditionAllFinds(PhysicalConditionAllFinds);
                JXLOG("身体状况", GetPhysicalConditionAllFinds(PhysicalConditionAllFinds));
                MajorAllFinds = GetJLJX_CHList(MajorAllFinds, "专业");
                resumeInfo.Specialty = GetMajor(MajorAllFinds);
                if (resumeInfo.Specialty.Length == 0)
                {
                    var isBreak = false;
                    var we = GetSpecialInformationStr(allWord, "教育经历");
                    foreach (var item in we)
                    {
                        if (isBreak)
                        {
                            break;
                        }
                        foreach (var str in ResumeAnalysisPackage.SchoolMajorCompilation)
                        {
                            if (item.Contains(str))
                            {
                                resumeInfo.Specialty = str;
                                isBreak = true;
                                if (isBreak)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
                JXLOG("专业", GetMajor(MajorAllFinds));
                resumeInfo.DegreeName = GetDegreeName(DegreeNameFinds);
                JXLOG("学历", GetDegreeName(DegreeNameFinds));
                GraduationSchoolAllFinds = GetJLJX_CHList(GraduationSchoolAllFinds, "毕业院校");
                resumeInfo.Graduated = GetGraduationSchool(GraduationSchoolAllFinds);
                foreach (var item in ResumeAnalysisPackage.SchoolTypeCompilation)
                {
                    if (resumeInfo.Graduated.Contains(item))
                    {
                        resumeInfo.Graduated = resumeInfo.Graduated.Substring(0, resumeInfo.Graduated.IndexOf(item) + item.Length);
                    }
                }
                JXLOG("毕业院校", GetGraduationSchool(GraduationSchoolAllFinds));
                HobbiesSpecialtiesAllFinds = GetJLJX_CHList(HobbiesSpecialtiesAllFinds, "爱好特长");
                resumeInfo.Hobbies = GetHobbiesSpecialties(HobbiesSpecialtiesAllFinds);
                JXLOG("爱好特长", GetHobbiesSpecialties(HobbiesSpecialtiesAllFinds));
                SalaryRequirementsAllFinds = GetJLJX_CHList(SalaryRequirementsAllFinds, "薪资要求");
                resumeInfo.Salaries = GetSalaryRequirements(SalaryRequirementsAllFinds);
                JXLOG("薪资要求", GetSalaryRequirements(SalaryRequirementsAllFinds));
                QQAllFinds = GetJLJX_CHList(QQAllFinds, "QQ_MSN");
                resumeInfo.qq = GetQQ(QQAllFinds);
                JXLOG("QQ_MSN", GetQQ(QQAllFinds));

                EMailAllFinds = GetJLJX_CHList(EMailAllFinds, "E_Mail");
                resumeInfo.email = GetEMail(EMailAllFinds);
                JXLOG("E_Mail", GetEMail(EMailAllFinds));
                PhoneAllFinds = GetJLJX_CHList(PhoneAllFinds, "联系电话");
                resumeInfo.phone = GetPhone(PhoneAllFinds);
                JXLOG("联系电话", GetPhone(PhoneAllFinds));
                LanguageAbilityAllFinds = GetJLJX_CHList(LanguageAbilityAllFinds, "语言能力");
                resumeInfo.ForeignLanguage = GetLanguageAbility(LanguageAbilityAllFinds);
                JXLOG("语言能力", GetLanguageAbility(LanguageAbilityAllFinds));

                var strList111 = GetSpecialInformationStr(allWord, "工作经历");
                var strList = new List<string>();
                List<string> specialInfos = specialInformation1.Split(',').ToList();
                foreach (var specialInfo in specialInfos)
                {
                    strList.AddRange(GetSpecialInformationStr(allWord, specialInfo));
                }
                strList = GetJLJX_CHList(strList, "自我介绍");
                strList = strList.Distinct().ToList();
                resumeInfo.SelfIntroduct = string.Join("\n", strList.Distinct()).Replace("个大简历", "").Replace("个人简历", "");

                var strListjyjl = GetSpecialInformationStr(allWord, "教育经历");
                resumeInfo.EducationManagers = GetEducation(strListjyjl);


                var strListgzjl = GetSpecialInformationStr(allWord, "工作经历");
                resumeInfo.WorkExperiences = GetWorkExperience(strListgzjl);

                var strListxmjl = GetSpecialInformationStr(allWord, "项目经历");
                resumeInfo.ProjectExperiences = GetProjectExperience(strListxmjl);
                if (resumeInfo.ProjectExperiences.Count() == 0)
                {
                    var strListxmj2 = GetSpecialInformationStr(allWord, "项目经验");
                    resumeInfo.ProjectExperiences = GetProjectExperience(strListxmj2);

                }
                resumeInfo.AllItem = string.Join("\n", allWord.Distinct());
            }
            return resumeInfo;

        }



        #region 判断
        private List<string> VerificationStr(string words, string needFindStr)
        {
            List<string> resultInfo = new List<string>(); ;
            //情况：XXX：XXX，这种半格式文本情况下，基本可以百分百确定“：”后面是XXX
            if (words.Contains($"{needFindStr}："))
                resultInfo.Add(words);

            //情况：XXX:XXX，这种半格式文本情况下，基本可以百分百确定“：”后面是XXX
            if (words.Contains($"{needFindStr}:"))
                resultInfo.Add(words);
            return resultInfo;
        }

        /// <summary>
        ///     获取姓名
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationName(string words, int currindex = -1)
        {
            List<string> resultInfo = new List<string>(); ;
            //情况：姓名：XXX，这种半格式文本情况下，基本可以百分百确定“：”后面是姓名
            if (words.Contains("姓名："))
                resultInfo.Add(words);

            //情况：姓名:XXX，这种半格式文本情况下，基本可以百分百确定“：”后面是姓名
            if (words.Contains("姓名:"))
                resultInfo.Add(words);

            //情况：name:XXX，这种半格式文本情况下，基本可以百分百确定“：”后面是姓名
            if (words.ToLower().Contains("name:"))
                resultInfo.Add(words);

            //情况：XXX，不是半格式文本的情况，我们要通过姓氏来确定
            if (words.ToLower().Contains("name:"))
                resultInfo.Add(words);


            foreach (var item in ResumeAnalysisPackage.ShortSurnameCompilation)
            {
                if (item.Length <= 10)
                {
                    if (words.Contains(item))
                        resultInfo.Add(words);
                }
            }
            return resultInfo;
        }


        /// <summary>
        ///     验证性别
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationGender(string words, int currindex = -1)
        {

            List<string> resultInfo = new List<string>(); ;
            //情况：性别：X，这种半格式文本情况下，基本可以百分百确定“：”后面是性别
            if (words.Contains("性别："))
                resultInfo.Add(words);
            if (words.Contains("性别:"))
                resultInfo.Add(words);
            if (words.ToLower().Contains("gender:"))
                resultInfo.Add(words);


            //情况：XXX，不是半格式文本的情况，我们要通过单字符来确定
            if (words.ToLower().Contains("male"))
                resultInfo.Add(words);
            if (words.Contains("男"))
                resultInfo.Add(words);
            if (words.Contains("女"))
                resultInfo.Add(words);


            return resultInfo;
        }


        /// <summary>
        ///     验证年龄
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationAge(string words, int currindex = -1)
        {
            List<string> resultInfo = new List<string>();
            //情况：年龄半格式情况下一定有年龄
            if (words.Contains("年龄"))
                resultInfo.Add(words);
            //有些时候会遇到岁的情况，在一句表达里面。
            if (words.ToLower().Contains("周岁"))
                resultInfo.Add(words);
            if (words.Contains("岁"))
                resultInfo.Add(words);
            return resultInfo;
        }


        /// <summary>
        ///     验证身高
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationHeight(string words, int currindex = -1)
        {
            List<string> resultInfo = new List<string>(); ;
            //情况：身高：X，这种半格式文本情况下，基本可以百分百确定“：”后面是身高
            if (words.Contains("身高"))
                resultInfo.Add(words);
            if (words.ToLower().Contains("米"))
                resultInfo.Add(words);
            if (words.Contains("厘米"))
                resultInfo.Add(words);
            if (words.ToLower().Contains("cm"))
                resultInfo.Add(words);
            if (words.ToLower().Contains("m"))
                resultInfo.Add(words);
            return resultInfo;
        }

        /// <summary>
        ///     验证体重
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationWeight(string words, int currindex = -1)
        {
            List<string> resultInfo = new List<string>(); ;
            //情况：体重：X，这种半格式文本情况下，基本可以百分百确定“：”后面是体shi'jian重
            if (words.Contains("体重"))
                resultInfo.Add(words);
            if (words.ToLower().Contains("斤"))
                resultInfo.Add(words);
            if (words.ToLower().Contains("千克"))
                resultInfo.Add(words);
            if (words.ToLower().Contains("kg"))
                resultInfo.Add(words);
            return resultInfo;
        }

        /// <summary>
        ///     验证婚姻状态
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationMaritalStatus(string words, int currindex = -1)
        {
            List<string> resultInfo = new List<string>(); ;
            //有关婚姻状况的直接 [ 已婚 、 未婚 ] 判断做分类
            if (words.Contains("已婚"))
                resultInfo.Add(words);
            if (words.Contains("未婚"))
                resultInfo.Add(words);
            return resultInfo;
        }

        /// <summary>
        ///     验证出生日期
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationBirthday(string words, int currindex = -1)
        {
            List<string> resultInfo = new List<string>();
            if (words.Contains("出生日期") || words.Contains("出生年月") || words.Contains("生日"))
                if (words.IndexOf("/") >= 2 || words.IndexOf("-") >= 2 || words.IndexOf(".") >= 2)
                    if (words.Contains("19") || words.Contains("20"))
                    {
                        resultInfo.Add(words);
                    }
                    else
                    {
                        var word01 = NextWord(currindex);
                        if (word01.IndexOf("/") >= 2 || word01.IndexOf("-") >= 2 || word01.IndexOf(".") >= 2)
                            if (words.Contains("19") || word01.Contains("20"))
                                resultInfo.Add(word01);
                    }


            // 搜索这种格式 1990-03-08  1990/03/08   2000-03-08  2000/03/08
            if (words.IndexOf("/") >= 2 || words.IndexOf("-") >= 2 || words.IndexOf(".") >= 2)
                if (words.Contains("19") || words.Contains("20"))
                    resultInfo.Add(words);
            return resultInfo;
        }



        /// <summary>
        ///     验证户口地址
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationHometownAddress(string words, int currindex = -1)
        {
            //获取所有省份信息：
            List<string> resultInfo = new List<string>();
            foreach (var item in ResumeAnalysisPackage.AccountAddressCompilation)
            {
                if (item.Length > 10)
                {
                    if (words.Contains(item))
                        resultInfo.Add(words);
                }
            }
            return resultInfo;
        }

        /// <summary>
        ///     验证籍贯地址
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationHometownShortAddress(string words, int currindex = -1)
        {
            //获取所有省份信息：
            List<string> resultInfo = new List<string>();
            foreach (var item in ResumeAnalysisPackage.HometownAddressCompilation)
            {
                //if (item.Length <= 10)
                //{
                if (words.Contains(item))
                    resultInfo.Add(words);
                //}
            }

            if (words.Contains("籍贯"))
                foreach (var item in ResumeAnalysisPackage.HometownAddressCompilation)
                {
                    var word01 = NextWord(currindex);
                    if (word01.Contains(item))
                        resultInfo.Add(word01);
                }

            if (words.Contains("籍贯："))
                resultInfo.Add(words);
            return resultInfo;
        }


        /// <summary>
        ///     验证身份证
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationIdentityCards(string words, int currindex = -1)
        {
            List<string> resultInfo = new List<string>(); ;
            // 情况：身份证：X，这种半格式文本情况下，基本可以百分百确定“：”后面是身份证
            if (words.Contains("身份证"))
                resultInfo.Add(words);
            // 只有数值：如 1100XX1990XXXXXXXX , 这里的 X 表示数值
            // 先匹配 19 或 20，代表着两个世纪出生的人
            if (words.Contains("19") || words.Contains("20"))
                resultInfo.Add(words);

            return resultInfo;
        }

        /// <summary>
        ///     验证民族
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationNation(string words, int currindex = -1)
        {
            List<string> resultInfo = new List<string>(); ;
            // 情况：民族：X，这种半格式文本情况下，基本可以百分百确定“：”后面是民族
            if (words.Contains("民族"))
                resultInfo.Add(words);
            if (words.Contains("族"))
                resultInfo.Add(words);
            foreach (var item in ResumeAnalysisPackage.NationCompilation)
                if (item.Length <= 10)
                    if (words.Contains(item))
                        resultInfo.Add(words);
            return resultInfo;
        }

        /// <summary>
        ///     验证政治面貌
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationPoliticalOutlook(string words, int currindex = -1)
        {
            List<string> resultInfo = new List<string>();
            // 情况：政治面貌：X，这种半格式文本情况下，基本可以百分百确定“：”后面是政治面貌
            if (words.Contains("政治面貌"))
                resultInfo.Add(words);
            foreach (var item in ResumeAnalysisPackage.PoliticalOutlookCompilation)
                if (item.Length <= 10)
                    if (words.Contains(item))
                        resultInfo.Add(words);
            return resultInfo;
        }



        /// <summary>
        ///     验证语言能力
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationLanguageAbility(string words, int currindex = -1)
        {
            List<string> resultInfo = new List<string>();
            // 情况：语言：X，这种半格式文本情况下，基本可以百分百确定“：”后面是语言
            if (words.Contains("语言"))
                if (words.Contains(":"))
                    resultInfo.Add(words);
            foreach (var item in ResumeAnalysisPackage.LanguageAbilityCompilation)
                if (item.Length <= 10)
                    if (words.Contains(item))
                        resultInfo.Add(words);
            if (words.Contains("语言能力"))
            {
                var word01 = NextWord(currindex);
                resultInfo.Add(word01);
                for (int i = 1; i < 100; i++)
                {
                    if (!string.IsNullOrWhiteSpace(NextWord(currindex + i)))
                        if (NextWord(currindex + i).Contains("语") ||
                            NextWord(currindex + i).Contains("话"))
                        {
                            resultInfo.Add(NextWord(currindex + i));
                        }
                        else
                        {
                            break;
                        }
                }
            }
            return resultInfo;
        }

        /// <summary>
        ///     验证英语水平
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationEnglishLevel(string words, int currindex = -1)
        {
            List<string> resultInfo = new List<string>();
            // 情况：英语水平：X，这种半格式文本情况下，基本可以百分百确定“：”后面是英语水平
            if (words.Contains("英语水平"))
                resultInfo.Add(words);
            if (words.Contains("英语"))
                if (words.Contains("级"))
                    resultInfo.Add(words);
            return resultInfo;
        }


        /// <summary>
        ///     验证计算机水平
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationComputerLevel(string words, int currindex = -1)
        {
            List<string> resultInfo = new List<string>();
            // 情况：计算机水平：X，这种半格式文本情况下，基本可以百分百确定“：”后面是计算机水平
            if (words.Contains("计算机水平"))
                resultInfo.Add(words);
            if (words.Contains("计算机"))
                if (words.Contains("级"))
                    resultInfo.Add(words);
            return resultInfo;
        }

        /// <summary>
        ///     验证博客/主页地址
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationBlog(string words, int currindex = -1)
        {
            List<string> resultInfo = new List<string>();
            if (words.Contains("http"))
                resultInfo.Add(words);

            if (words.Split('.').Count() >= 3)
                resultInfo.Add(words);
            return resultInfo;
        }



        /// <summary>
        ///     验证身体状况
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationPhysicalCondition(string words, int currindex = -1)
        {
            //获取所有健康信息：
            string allA = "健康、良好、一般、较差";
            List<string> allss = allA.Split(new string[] { "、" }, StringSplitOptions.RemoveEmptyEntries).ToList();


            List<string> resultInfo = new List<string>();
            foreach (var item in allss)
            {
                if (item.Length < 8)
                {
                    if (words.Contains(item))
                        resultInfo.Add(words);
                }
            }
            if (words.Contains("健康状况") || words.Contains("身体状况"))
                resultInfo.Add(words);
            return resultInfo;
        }


        /// <summary>
        ///     验证专业
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationMajor(string words, int currindex = -1)
        {

            List<string> resultInfo = new List<string>();
            if (words.Contains("专业"))
            {
                var word01 = NextWord(currindex);
                resultInfo.Add(word01);
            }

            if (words.Contains("专业："))
                resultInfo.Add(words);
            if (words.Contains("专业:"))
                resultInfo.Add(words);
            return resultInfo;
        }


        /// <summary>
        ///     验证学历
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationDegreeName(string words, int currindex = -1)
        {

            List<string> resultInfo = new List<string>();
            if (words.Contains("学历"))
            {
                var word01 = NextWord(currindex);
                resultInfo.Add(word01);
            }

            if (words.Contains("学历："))
                resultInfo.Add(words);
            if (words.Contains("学历:"))
                resultInfo.Add(words);


            foreach (var degree in ResumeAnalysisPackage.DegreeCompilation)
            {
                if (words.Contains(degree))
                {
                    resultInfo.Add(words);
                }

            }
            return resultInfo;
        }


        /// <summary>
        ///     验证毕业院校
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationGraduationSchool(string words, int currindex = -1)
        {

            List<string> resultInfo = new List<string>();
            if (words.Contains("毕业院校"))
            {
                var word01 = NextWord(currindex);
                resultInfo.Add(word01);
            }

            if (words.Contains("毕业院校："))
                resultInfo.Add(words);
            if (words.Contains("毕业院校:"))
                resultInfo.Add(words);
            if (words.Contains("大学"))
                resultInfo.Add(words);
            if (words.Contains("学校"))
                resultInfo.Add(words);
            return resultInfo;
        }



        /// <summary>
        ///     验证爱好特长
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationHobbiesSpecialties(string words, int currindex = -1)
        {

            List<string> resultInfo = new List<string>();
            if (words.Contains("爱好"))
            {
                var word01 = NextWord(currindex);
                resultInfo.Add(word01);
            }

            if (words.Contains("爱好："))
                resultInfo.Add(words);
            if (words.Contains("特长："))
                resultInfo.Add(words);
            if (words.Contains("爱好:"))
                resultInfo.Add(words);
            if (words.Contains("特长:"))
                resultInfo.Add(words);
            return resultInfo;
        }



        /// <summary>
        ///     验证薪资要求
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationSalaryRequirements(string words, int currindex = -1)
        {

            List<string> resultInfo = new List<string>();
            if (words.Contains("薪资要求"))
            {
                var word01 = NextWord(currindex);
                resultInfo.Add(word01);
            }

            if (words.Contains("薪资要求："))
                resultInfo.Add(words);
            if (words.Contains("薪资要求:"))
                resultInfo.Add(words);
            return resultInfo;
        }


        /// <summary>
        ///     验证qq
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationQQ(string words, int currindex = -1)
        {

            List<string> resultInfo = new List<string>();
            if (words.Contains("QQ"))
            {
                var word01 = NextWord(currindex);
                resultInfo.Add(word01);
            }

            if (words.Contains("QQ："))
                resultInfo.Add(words);
            if (words.Contains("QQ:"))
                resultInfo.Add(words);
            return resultInfo;
        }


        /// <summary>
        ///     验证邮箱
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationEMail(string words, int currindex = -1)
        {

            List<string> resultInfo = new List<string>();
            if (words.Contains("邮箱") || words.Contains("E-Mail"))
            {
                var word01 = NextWord(currindex);
                resultInfo.Add(word01);
            }

            if (words.Contains("EMail："))
                resultInfo.Add(words);
            if (words.Contains("EMail:"))
                resultInfo.Add(words);
            if (words.Contains("E-Mail："))
                resultInfo.Add(words);
            if (words.Contains("E-Mail:"))
                resultInfo.Add(words);
            if (words.Contains("邮箱："))
                resultInfo.Add(words);
            if (words.Contains("邮箱:"))
                resultInfo.Add(words);
            if (words.Contains("邮箱"))
                resultInfo.Add(words);
            if (words.Contains("@"))
                if (words.Contains("."))
                    resultInfo.Add(words);
            return resultInfo;
        }




        /// <summary>
        ///     验证联系电话
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<string> VerificationPhone(string words, int currindex = -1)
        {

            List<string> resultInfo = new List<string>();
            if (words.Contains("联系电话") || words.Contains("Phone"))
            {
                var word01 = NextWord(currindex);
                resultInfo.Add(word01);
            }

            if (words.Contains("联系电话："))
                resultInfo.Add(words);
            if (words.Contains("联系电话:"))
                resultInfo.Add(words);
            if (words.Contains("Phone："))
                resultInfo.Add(words);
            if (words.Contains("Phone:"))
                resultInfo.Add(words);


            if (words.Contains("13"))
                if (words.Length > 10)
                    resultInfo.Add(words);
            return resultInfo;
        }



        #endregion

        #region 工具

        private string NextWord(int currindex)
        {
            var we = "";
            if (currindex > 0)
            {
                if (jArrayORCResultall.Count() - 1 != currindex)
                {
                    we = jArrayORCResultall[currindex + 1];
                }
            }

            return we;
        }


        /// <summary>
        /// 误判词、不含词：过滤器，获取过滤结果
        /// </summary>
        /// <param name="yxc"></param>
        /// <param name="qzm"></param>
        /// <returns></returns>
        private List<string> GetJLJX_CHList(List<string> yxc, string qzm)
        {
            qzm = qzm.Replace("-", "_").Replace("/", "_").Replace("\\", "_");
            if (true)
            {
                var wpclist = RADataHelp.GetRADataRW($"_误判词_{qzm}");
                if (wpclist != null && wpclist.Count() > 0)
                    yxc = yxc.Where(x => x != null && !wpclist.Contains(x)).ToList();

            }
            if (true)
            {
                var bhclist = RADataHelp.GetRADataRW($"_不含词_{qzm}");

                if (bhclist != null && bhclist.Count() > 0)
                    foreach (var item in bhclist)
                    {
                        yxc = yxc.Where(x => x != null && !x.Contains(item)).ToList();
                    }
            }
            return yxc;
        }


        #endregion


        #region 获取

        private string VerificationGetStr(List<string> words, string needFindStr, int length)
        {
            foreach (var word in words)
            {
                var list = VerificationStr(word, needFindStr);
                if (list != null)
                {
                    if (list.Count() > 0)
                    {
                        return list[0];
                    }
                }
            }
            return "";

        }




        List<string> GetSpecialInformationStr(List<string> words, string specialInfoStr)
        {
            var startIndex = 0;
            var endIndex = 0;
            var resultInfo = new List<string>();
            var siiIndex = GetSpecialInformationIndex(words);
            siiIndex = siiIndex.OrderBy(a => a).ToList();
            for (int i = 0; i < siiIndex.Count(); i++)
            {
                if (words[siiIndex[i]].Contains(specialInfoStr))
                {
                    if (i + 1 == siiIndex.Count())
                    {
                        startIndex = siiIndex[i];
                        endIndex = words.Count() - 1;
                    }
                    else
                    {
                        startIndex = siiIndex[i];
                        endIndex = siiIndex[i + 1] - 1;
                        for (int j = i; j < siiIndex.Count(); j++)
                        {
                            if (endIndex < 0)
                            {
                                if (j < siiIndex.Count() - 1)
                                {
                                    endIndex = siiIndex[j + 1] - 1;
                                }
                            }
                            else
                            {
                                break;
                            }
                        }

                        if (endIndex < 0)
                        {
                            endIndex = words.Count() - 1;
                        }
                    }
                }
            }
            for (int i = startIndex; i <= endIndex; i++)
            {
                resultInfo.Add((string)words[i]);
            }
            return resultInfo;
        }


        /// <summary>
        ///     获取特殊信息索引
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        List<int> GetSpecialInformationIndex(List<string> words)
        {
            //for (int i = 0; i < words.Count(); i++)
            //{
            //    if (words[i].Contains("教育经历"))
            //        tsxxIndex.Add(i);
            //    if (words[i].Contains("自我评价"))
            //        tsxxIndex.Add(i);
            //    if (words[i].Contains("工作经历"))
            //        tsxxIndex.Add(i);
            //    if (words[i].Contains("项目经历"))
            //        tsxxIndex.Add(i);
            //    if (words[i].Contains("社交主页"))
            //        tsxxIndex.Add(i);
            //    if (words[i].Contains("资格证书"))
            //        tsxxIndex.Add(i);
            //    if (words[i].Contains("教育/培训经历"))
            //        tsxxIndex.Add(i);
            //    if (words[i].Contains("培训经历"))
            //        tsxxIndex.Add(i);
            //    if (words[i].Contains("个人简介"))
            //        tsxxIndex.Add(i);
            //}


            List<string> vs = specialInformation.Split(',').ToList();
            List<int> tsxxIndex = new List<int>();

            foreach (var item in vs)
            {
                tsxxIndex.Add(GetBigDataIndex(words, item));
            }


            return tsxxIndex;
        }





        /// <summary>
        ///     获取数据索引
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        int GetBigDataIndex(List<string> words, string specialInfo)
        {
            var retIndex = 0;
            var lenght = 999999999999;
            for (int i = 0; i < words.Count(); i++)
            {
                if (words[i].Contains(specialInfo))
                {
                    if (lenght >= words[i].Length)
                    {
                        lenght = words[i].Length;
                        retIndex = i;
                    }
                }
            }
            return retIndex;
        }


        /// <summary>
        ///     获取姓名
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetName(List<string> words)
        {
            string resultInfo = "";
            foreach (var word in words)
            {
                //情况：姓名：XXX，这种半格式文本情况下，基本可以百分百确定“：”后面是姓名
                if (word.Contains("姓名："))
                {
                    resultInfo = word.Replace("姓名：", "");
                    break;
                }

                //情况：姓名:XXX，这种半格式文本情况下，基本可以百分百确定“：”后面是姓名
                if (word.Contains("姓名:"))
                {
                    resultInfo = word.Replace("姓名:", "");
                    break;
                }

                //情况：name:XXX，这种半格式文本情况下，基本可以百分百确定“：”后面是姓名
                if (word.ToLower().Contains("name:"))
                {
                    resultInfo = word.ToLower().Replace("name:", "");
                    break;
                }


                var noSurname = true;
                //循环姓氏信息（长）获取我们的姓氏相关姓名
                foreach (var item in ResumeAnalysisPackage.LongSurnameCompilation)
                {
                    if (words.Contains(item))
                        noSurname = false;
                }


                //获取所有姓氏信息：


                //如果上面几种半格式化判定都无效，这个时候，我们就进行一个算法校准，单纯姓名的情况下，我们的名字不会超过 4 个字
                if (noSurname)
                {
                    if (word.Trim().Length <= 4)
                    {
                        if (word.Trim().Length > 1)
                        {
                            var danword = word.Trim()[0].ToString();
                            var surname = ResumeAnalysisPackage.ShortSurnameCompilation.Where(a => a.Length == 1 && a == danword);
                            if (surname.Any())
                            {
                                resultInfo = word;
                                break;
                            }
                        }
                        if (word.Trim().Length > 2)
                        {
                            var danword = word.Trim()[0].ToString() + word.Trim()[1].ToString();
                            var surname = ResumeAnalysisPackage.ShortSurnameCompilation.Where(a => a.Length == 2 && a == danword);
                            if (surname.Any())
                            {
                                resultInfo = word;
                                break;
                            }
                        }
                    }
                }
            }
            return resultInfo.Trim();

        }


        /// <summary>
        ///     获取性别
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetGender(List<string> words)
        {
            string resultInfo = "";
            foreach (var word in words)
            {
                //情况：性别：XXX，这种半格式文本情况下，基本可以百分百确定“：”后面是性别
                if (word.Contains("性别："))
                {
                    resultInfo = word.Replace("性别：", "");
                    break;
                }

                //情况：性别:XXX，这种半格式文本情况下，基本可以百分百确定“：”后面是性别
                if (word.Contains("性别:"))
                {
                    resultInfo = word.Replace("性别:", "");
                    break;
                }

                //情况：gender:XXX，这种半格式文本情况下，基本可以百分百确定“：”后面是性别
                if (word.ToLower().Contains("gender:"))
                {
                    resultInfo = word.ToLower().Replace("gender:", "");
                    break;
                }


                //情况：gender:XXX，这种半格式文本情况下，基本可以百分百确定“：”后面是性别
                if (word.Length < 3)
                {
                    if (word.ToLower().Contains("男"))
                    {
                        resultInfo = "男";
                    }
                    else if (word.ToLower().Contains("女"))
                    {
                        resultInfo = "女";
                    }
                    break;
                }
            }
            if (resultInfo.Length == 0)
            {
                foreach (var word in words)
                {
                    var wordsubs = word.Split(new string[] { "、", "|", "\\", "/" }, StringSplitOptions.RemoveEmptyEntries).ToList();
                    foreach (var itemwordsub in wordsubs)
                    {
                        if (itemwordsub.Length > 0)
                        {
                            if (itemwordsub.Substring(0, 1) == "男" ||
                                itemwordsub.Substring(0, 1) == "女")
                            {
                                resultInfo = itemwordsub.Substring(0, 1);
                                break;
                            }
                        }
                    }
                }
            }
            return resultInfo;
        }

        /// <summary>
        ///     获取年龄
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetAge(List<string> words)
        {
            string resultInfo = "";
            foreach (var word in words)
            {
                if (word.Contains("年龄："))
                {
                    resultInfo = word.Replace("年龄：", "");
                    break;
                }

                if (word.Contains("年龄:"))
                {
                    resultInfo = word.Replace("年龄:", "");
                    break;
                }

                if (word.ToLower().Contains("age:"))
                {
                    resultInfo = word.ToLower().Replace("age:", "");
                    break;
                }
            }
            return resultInfo;
        }

        /// <summary>
        ///     获取身高
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetHight(List<string> words)
        {
            string resultInfo = "";
            foreach (var word in words)
            {
                if (word.Contains("身高："))
                {
                    resultInfo = word.Replace("身高：", "");
                    break;
                }

                if (word.Contains("身高:"))
                {
                    resultInfo = word.Replace("身高:", "");
                    break;
                }

                if (word.ToLower().Contains("Hight:"))
                {
                    resultInfo = word.ToLower().Replace("Hight:", "");
                    break;
                }
            }
            return resultInfo;
        }


        /// <summary>
        ///     获取身高
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetWeight(List<string> words)
        {
            string resultInfo = "";
            foreach (var word in words)
            {
                if (word.Contains("体重："))
                {
                    resultInfo = word.Replace("体重：", "");
                    break;
                }

                if (word.Contains("体重:"))
                {
                    resultInfo = word.Replace("体重:", "");
                    break;
                }
            }
            return resultInfo;
        }


        /// <summary>
        ///     获取婚姻状况
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetStatusAllFinds(List<string> words)
        {
            string resultInfo = "";
            if (words.Count() > 0)
            {
                resultInfo = words[0];
            }
            return resultInfo;
        }





        /// <summary>
        ///     获取出生日期
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetBirthday(List<string> words)
        {
            var resultDateTime = DateTime.Now;
            string resultInfo = "";
            List<string> date = new List<string>();
            foreach (var word in words)
            {
                if (word.Contains("出生日期："))
                {
                    resultInfo = word.Replace("出生日期：", "").Replace(" ", "").Replace(".", "-").Replace("/", "-").Substring(0, 10);

                    break;
                }

                if (word.Contains("出生日期:"))
                {
                    resultInfo = word.Replace("出生日期:", "").Replace(" ", "").Replace(".", "-").Replace("/", "-").Substring(0, 10);
                    break;
                }

                if (word.Contains("生日"))
                {
                    resultInfo = word.Replace("生日", "").Replace(" ", "").Replace(".", "-").Replace("/", "-").Substring(0, 10);
                    break;
                }

                if (word.GetStrShowCount("/") == 2 || word.GetStrShowCount("-") == 2 || word.GetStrShowCount(".") == 2)
                    if (word.Contains("19") || word.Contains("20"))
                    {
                        resultInfo = word.Replace(" ", "").Replace(".", "-").Replace("/", "-").Substring(0, 10);
                        if (DateTime.TryParse(resultInfo, out DateTime dateTime))
                        {
                            if (dateTime < resultDateTime)
                            {
                                resultInfo = dateTime.ToString("yyyy-MM-dd");
                            }
                            else
                            {
                                resultInfo = resultDateTime.ToString("yyyy-MM-dd");
                            }
                        }
                        break;
                    }
            }
            return resultInfo;
        }


        /// <summary>
        ///     获取籍贯
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetHometownShortAddress(List<string> words)
        {
            string resultInfo = "";
            List<string> date = new List<string>();
            foreach (var word in words)
            {
                if (word.Contains("籍贯："))
                {
                    resultInfo = word.Replace("籍贯：", "").Replace(" ", "");

                    break;
                }

                if (word.Contains("籍贯:"))
                {
                    resultInfo = word.Replace("籍贯:", "").Replace(" ", "");
                    break;
                }

                if (word.Length > "籍贯".Length)
                {
                    resultInfo = word.Replace("籍贯", "").Replace(" ", "");
                    break;
                }
                if (word.Length > 2 && word.Length < 8)
                {
                    resultInfo = word.Replace(" ", "");
                }
            }
            return resultInfo;
        }




        /// <summary>
        ///     获取民族
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetNation(List<string> words)
        {
            string resultInfo = "";
            List<string> date = new List<string>();
            foreach (var word in words)
            {
                if (word.Contains("民族："))
                {
                    resultInfo = word.Replace("民族：", "").Replace(" ", "");

                    break;
                }

                if (word.Contains("民族:"))
                {
                    resultInfo = word.Replace("民族:", "").Replace(" ", "");
                    break;
                }

                if (word.Contains("民族"))
                {
                    if (word.Length > "民族".Length)
                    {
                        resultInfo = word.Replace("民族", "").Replace(" ", "");
                        break;
                    }
                }
                if (word.Length > 0 && word.Length < 10)
                {
                    //if (word.Contains("族"))
                    //{
                    //    resultInfo = word.Replace(" ", "");
                    //}
                    //else
                    //{
                    foreach (var item in ResumeAnalysisPackage.NationCompilation)
                        if (word.Contains(item))
                            resultInfo = word;
                    //}
                }
            }
            return resultInfo;
        }




        /// <summary>
        ///     获取身体状况
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetPhysicalConditionAllFinds(List<string> words)
        {
            //获取所有省份信息：
            string allA = "健康、良好、一般、较差";
            List<string> allss = allA.Split(new string[] { "、" }, StringSplitOptions.RemoveEmptyEntries).ToList();

            string resultInfo = "";
            foreach (var word in words)
            {
                if (word.Contains("健康状况："))
                {
                    resultInfo = word.Replace("健康状况：", "").Replace(" ", "");

                    break;
                }
                if (word.Contains("健康状况:"))
                {
                    resultInfo = word.Replace("健康状况:", "").Replace(" ", "");
                    break;
                }

                if (word.Contains("健康状况"))
                {
                    if (word.Length > "健康状况".Length)
                    {
                        resultInfo = word.Replace("健康状况", "").Replace(" ", "");
                        break;
                    }
                }

                if (word.Contains("身体状况："))
                {
                    resultInfo = word.Replace("身体状况：", "").Replace(" ", "");

                    break;
                }
                if (word.Contains("身体状况:"))
                {
                    resultInfo = word.Replace("身体状况:", "").Replace(" ", "");
                    break;
                }

                if (word.Contains("身体状况"))
                {
                    if (word.Length > "身体状况".Length)
                    {
                        resultInfo = word.Replace("身体状况", "").Replace(" ", "");
                        break;
                    }
                }
                if (word.Length > 0 && word.Length < 10)
                {
                    foreach (var item in allss)
                        if (word.Contains(item))
                            resultInfo = word;
                }
            }
            return resultInfo;
        }


        /// <summary>
        ///     获取专业
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetMajor(List<string> words)
        {
            string resultInfo = "";
            if (words.Count() == 1)
            {
                resultInfo = words[0].Replace("专业", "").Replace(":", "").Replace("：", "").Replace(" ", "");
            }


            if (words.Count() > 1)
            {
                foreach (var word in words)
                {
                    if (word.Contains("专业"))
                    {
                        if (word.Replace(" ", "").Length > "专业".Length)
                        {
                            resultInfo = word.Replace("专业", "").Replace("专业", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                        }
                    }

                    //因为最长的专业名称是：毛泽东思想和中国特色社会主义理论体系概论
                    if (word.Replace(" ", "").Length > 1 && word.Replace(" ", "").Length < 25)
                    {
                        resultInfo = word.Replace("专业", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                    }
                }
            }
            return resultInfo;
        }




        /// <summary>
        ///     获取学历
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetDegreeName(List<string> words)
        {
            string resultInfo = "";
            if (words.Count() == 1)
            {
                resultInfo = words[0].Replace("最高学历", "").Replace("学历", "").Replace(":", "").Replace("：", "").Replace(" ", "");
            }

            foreach (var word in words)
            {
                foreach (var degree in ResumeAnalysisPackage.DegreeCompilation)
                {
                    if (word.Contains(degree))
                    {
                        if (word.Replace(" ", "").Length < 10)
                        {
                            resultInfo = degree;
                            break;
                        }
                    }
                }
            }

            foreach (var word in words)
            {
                foreach (var degree in ResumeAnalysisPackage.DegreeCompilation)
                {
                    if (word.Contains(degree))
                    {
                        resultInfo = degree;
                        break;
                    }
                }
            }
            return resultInfo;
        }



        /// <summary>
        ///     获取毕业院校
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetGraduationSchool(List<string> words)
        {
            string resultInfo = "";
            if (words.Count() == 1)
            {
                resultInfo = words[0].Replace("毕业院校", "").Replace(":", "").Replace("：", "").Replace(" ", "");
            }


            if (words.Count() > 1)
            {
                foreach (var word in words)
                {
                    if (word.Contains("毕业院校"))
                    {
                        if (word.Replace(" ", "").Length > "毕业院校".Length)
                        {
                            resultInfo = word.Replace("毕业院校", "").Replace("毕业院校", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                        }
                    }

                    if (word.Replace(" ", "").Length > 4 && word.Replace(" ", "").Length < 20)
                    {
                        resultInfo = word.Replace("毕业院校", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                    }
                }
            }
            return resultInfo;
        }




        /// <summary>
        ///     获取兴趣爱好
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetHobbiesSpecialties(List<string> words)
        {
            string resultInfo = "";
            if (words.Count() == 1)
            {
                resultInfo = words[0].Replace("兴趣", "").Replace("爱好", "").Replace(":", "").Replace("：", "").Replace(" ", "");
            }


            if (words.Count() > 1)
            {
                foreach (var word in words)
                {
                    if (word.Replace(" ", "").Length > 5)
                    {
                        resultInfo = word.Replace("兴趣", "").Replace("爱好", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                    }
                }
            }
            return resultInfo;
        }


        /// <summary>
        ///     获取薪资要求
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetSalaryRequirements(List<string> words)
        {
            string resultInfo = "";
            if (words.Count() == 1)
            {
                resultInfo = words[0].Replace("薪资要求", "").Replace(":", "").Replace("：", "").Replace(" ", "");
            }


            if (words.Count() > 1)
            {
                foreach (var word in words)
                {
                    if (word.Contains("薪资要求"))
                    {
                        if (word.Replace(" ", "").Length > "薪资要求".Length)
                        {
                            resultInfo = word.Replace("薪资要求", "").Replace("薪资要求", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                        }
                    }

                    if (word.Replace(" ", "").Length > 2 || word.Replace(" ", "").Length < 16)
                    {
                        resultInfo = word.Replace("薪资要求", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                    }
                }
            }
            return resultInfo;
        }


        /// <summary>
        ///     获取QQ
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetQQ(List<string> words)
        {
            string resultInfo = "";
            if (words.Count() == 1)
            {
                resultInfo = words[0].Replace("QQ", "").Replace(":", "").Replace("：", "").Replace(" ", "");
            }


            if (words.Count() > 1)
            {
                foreach (var word in words)
                {
                    if (word.Contains("QQ"))
                    {
                        if (word.Replace(" ", "").Length > "QQ".Length)
                        {
                            resultInfo = word.Replace("QQ", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                        }
                    }

                    if (word.Replace(" ", "").Length > 3 || word.Replace(" ", "").Length < 16)
                    {
                        resultInfo = word.Replace("QQ", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                    }
                }
            }
            return resultInfo;
        }


        /// <summary>
        ///     获取邮箱
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetEMail(List<string> words)
        {
            string resultInfo = "";
            if (words.Count() == 1)
            {
                resultInfo = words[0].Replace("邮箱", "").Replace("E-Mail", "").Replace(":", "").Replace("：", "").Replace(" ", "");
            }


            if (words.Count() > 1)
            {
                foreach (var word in words)
                {
                    if (word.Contains("邮箱"))
                    {
                        if (word.Replace(" ", "").Length > "邮箱".Length)
                        {
                            if (word.Replace(" ", "").Length > 5 || word.Replace(" ", "").Length < 36)
                            {
                                resultInfo = word.Replace("邮箱", "").Replace("E-Mail", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                            }
                        }
                    }

                    if (word.Replace(" ", "").Length > 5 || word.Replace(" ", "").Length < 36)
                    {
                        resultInfo = word.Replace("邮箱", "").Replace("E-Mail", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                    }
                }
            }
            return resultInfo;
        }




        /// <summary>
        ///     获取联系电话
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetPhone(List<string> words)
        {
            string resultInfo = "";
            if (words.Count() == 1)
            {
                resultInfo = words[0].Replace("联系电话", "").Replace("Phone", "").Replace(":", "").Replace("：", "").Replace(" ", "");
            }

            if (words.Count() > 1)
            {
                foreach (var word in words)
                {
                    if (word.Contains("联系电话"))
                    {
                        if (word.Replace(" ", "").Length > "联系电话".Length)
                        {
                            if (word.Replace(" ", "").Length > 5 && word.Replace(" ", "").Length < 20)
                            {
                                resultInfo = word.Replace("联系电话", "").Replace("Phone", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                            }
                        }
                    }

                    if (word.Replace(" ", "").Length > 5 && word.Replace(" ", "").Length < 20)
                    {
                        resultInfo = word.Replace("联系电话", "").Replace("Phone", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                    }
                }
            }
            return resultInfo;
        }


        /// <summary>
        ///     获取语言能力
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private string GetLanguageAbility(List<string> words)
        {
            string resultInfo = "";
            if (words.Count() == 1)
            {
                resultInfo = words[0].Replace("语言能力", "").Replace(":", "").Replace("：", "").Replace(" ", "");
            }

            if (words.Count() > 1)
            {
                words = words.Distinct().ToList();
                foreach (var word in words)
                {
                    if (word.Contains("语言能力"))
                    {
                        if (word.Replace(" ", "").Length > "语言能力".Length)
                        {
                            if (word.Replace(" ", "").Length > 5)
                            {
                                resultInfo = word.Replace("语言能力", "").Replace(":", "").Replace("：", "").Replace(" ", "");
                            }
                        }
                    }

                    if (word.Replace(" ", "").Length > 1)
                    {
                        resultInfo += word.Replace("语言能力", "").Replace(":", "").Replace("：", "").Replace(" ", "") + "    ";
                    }
                }
            }
            return resultInfo.Trim();
        }


        /// <summary>
        ///     获取教育信息
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<EducationManager> GetEducation(List<string> words)
        {
            List<EducationManager> result = new List<EducationManager>();
            List<int> infoIndexs = new List<int>();
            for (int i = 0; i < words.Count; i++)
            {
                if (words[i].Substring(0, 2) == "19" || words[i].Substring(0, 2) == "20")
                {
                    infoIndexs.Add(i);
                }
            }
            var oldSchool = "";
            var oldDepartment = "";
            for (int i = 0; i < infoIndexs.Count; i++)
            {
                var startIndex = infoIndexs[i];
                var endIndex = -1;
                if (i + 1 == infoIndexs.Count)
                {
                    endIndex = words.Count;
                }
                else
                {
                    endIndex = infoIndexs[i + 1];
                }
                var educationManager = new EducationManager();


                for (int k = startIndex; k < endIndex; k++)
                {
                    var wordItem = (string)words[k];
                    if (wordItem.Substring(0, 2) == "19" || wordItem.Substring(0, 2) == "20")
                    {

                        var currWordItem = wordItem.Replace("~", "").Replace(".", "-").Replace("/", "-").Replace("\\", "-").Replace("至今", "").Replace("年", "-").Replace("月", "-").Replace("日", "-").Replace(" ", "");
                        var startIndex1 = 0;
                        var startIndex2 = 0;
                        //假设性判断第一个是开始时间
                        if (currWordItem.IndexOf("19") != -1)
                        {
                            startIndex1 = currWordItem.IndexOf("19");
                            startIndex2 = currWordItem.IndexOf("19", currWordItem.IndexOf("19") + 4);
                        }
                        else
                        {
                            startIndex1 = currWordItem.IndexOf("20");
                            startIndex2 = currWordItem.IndexOf("20", currWordItem.IndexOf("20") + 4);
                        }
                        var StartDateArray = currWordItem.Substring(startIndex1, startIndex2).Split("-").ToList();
                        educationManager.EntryDate = GetData(StartDateArray);
                        var EndDateArray = currWordItem.Substring(startIndex2).Split("-").ToList();
                        educationManager.GraduationDate = GetData(EndDateArray);
                    }

                    foreach (var degree in ResumeAnalysisPackage.DegreeCompilation)
                    {
                        if (wordItem.Contains(degree))
                        {
                            educationManager.EducationalBackground = degree;
                        }
                    }

                    foreach (var schoolType in ResumeAnalysisPackage.SchoolTypeCompilation)
                    {
                        if (wordItem.Contains(schoolType))
                        {
                            var word = wordItem.Substring(0, wordItem.Length - wordItem.IndexOf(schoolType) + schoolType.Length);
                            educationManager.School = word;
                        }
                    }
                }


                if (string.IsNullOrWhiteSpace(educationManager.School))
                {
                    foreach (var schoolType in ResumeAnalysisPackage.SchoolTypeCompilation)
                    {
                        foreach (var wordItem in words)
                        {
                            if (wordItem.Contains(schoolType))
                            {
                                if (string.IsNullOrWhiteSpace(oldSchool))
                                {
                                    oldSchool = wordItem;
                                    educationManager.School = wordItem;
                                    break;
                                }
                                else
                                {
                                    if (oldSchool == wordItem)
                                    {
                                        oldSchool = "";
                                    }
                                }
                            }
                        }
                    }
                }

                //if (string.IsNullOrWhiteSpace(educationManager.Department))
                //{
                //    foreach (var item in GetSpecialInformationStr(allWord, "教育经历"))
                //    {
                //        foreach (var str in ResumeAnalysisPackage.SchoolMajorCompilation)
                //        {
                //            if (item.Contains(str))
                //            {
                //                educationManager.Department = str;
                //                break;
                //            }
                //        }
                //    }
                //}

                if (string.IsNullOrWhiteSpace(educationManager.Department))
                {
                    foreach (var item in ResumeAnalysisPackage.SchoolMajorCompilation)
                    {
                        foreach (var wordItem in words)
                        {
                            if (wordItem.Contains(item))
                            {
                                if (string.IsNullOrWhiteSpace(oldDepartment))
                                {
                                    oldDepartment = item;
                                    educationManager.Department = item;
                                    break;
                                }
                                else
                                {
                                    if (oldDepartment == wordItem)
                                    {
                                        oldDepartment = "";
                                    }
                                }
                            }
                        }
                    }
                }
                result.Add(educationManager);
            }
            return result;
        }



        /// <summary>
        ///     获取工作经历
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<WorkExperience> GetWorkExperience(List<string> words)
        {
            List<WorkExperience> result = new List<WorkExperience>();
            List<int> infoIndexs = new List<int>();
            for (int i = 0; i < words.Count; i++)
            {
                if (words[i].Length > 2)
                    if (words[i].Substring(0, 2) == "19" || words[i].Substring(0, 2) == "20")
                    {
                        infoIndexs.Add(i);
                    }

            }

            var oldWork = "";
            for (int i = 0; i < infoIndexs.Count; i++)
            {
                var startIndex = infoIndexs[i];
                var endIndex = -1;
                if (i + 1 == infoIndexs.Count)
                {
                    endIndex = words.Count;
                }
                else
                {
                    endIndex = infoIndexs[i + 1];
                }
                var workExperience = new WorkExperience();


                for (int k = startIndex; k < endIndex; k++)
                {
                    var wordItem = (string)words[k];
                    if (wordItem.Length > 2)
                        if (wordItem.Substring(0, 2) == "19" || wordItem.Substring(0, 2) == "20")
                        {

                            var currWordItem = wordItem.Replace("~", "").Replace(".", "-").Replace("/", "-").Replace("\\", "-").Replace("至今", "").Replace("年", "-").Replace("月", "-").Replace("日", "-").Replace(" ", "");
                            var startIndex1 = 0;
                            var startIndex2 = 0;
                            //假设性判断第一个是开始时间
                            if (currWordItem.IndexOf("19") != -1)
                            {
                                startIndex1 = currWordItem.IndexOf("19");
                                startIndex2 = currWordItem.IndexOf("19", currWordItem.IndexOf("19") + 4);
                            }
                            else
                            {
                                startIndex1 = currWordItem.IndexOf("20");
                                startIndex2 = currWordItem.IndexOf("20", currWordItem.IndexOf("20") + 4);
                            }
                            if (startIndex2 == -1)
                            {
                                startIndex2 = wordItem.Count() - 2;
                            }
                            if (startIndex2 > currWordItem.Length)
                            {
                                startIndex2 = currWordItem.Length;
                            }
                            var StartDateArray = currWordItem.Substring(startIndex1, startIndex2).Split("-").ToList();
                            workExperience.HireDate = GetData(StartDateArray);
                            var EndDateArray = currWordItem.Substring(startIndex2).Split("-").ToList();
                            workExperience.DimissionDate = GetData(EndDateArray);
                        }
                        else
                        {
                            workExperience.description = workExperience.description + wordItem + "\n";
                        }


                    if (wordItem.Contains("公司"))
                    {
                        if (wordItem.Substring(0, wordItem.IndexOf("公司") + 2).Length == wordItem.Length)
                        {
                            workExperience.WorkPlace = wordItem.Substring(0, wordItem.IndexOf("公司") + 2);

                        }
                    }

                }


                if (string.IsNullOrWhiteSpace(workExperience.WorkPlace))
                {
                    foreach (var wordItem in words)
                    {
                        if (wordItem.Contains("公司"))
                        {
                            if (string.IsNullOrWhiteSpace(oldWork))
                            {
                                oldWork = wordItem;
                                workExperience.WorkPlace = wordItem;
                                break;
                            }
                            else
                            {
                                if (oldWork == wordItem)
                                {
                                    oldWork = "";
                                }
                            }
                        }
                    }
                }

                result.Add(workExperience);
            }

            return result;
        }



        /// <summary>
        ///     获取项目经历
        /// </summary>
        /// <param name="words">内容</param>
        /// <returns></returns>
        private List<ProjectExperience> GetProjectExperience(List<string> words)
        {
            List<ProjectExperience> result = new List<ProjectExperience>();
            List<int> infoIndexs = new List<int>();
            for (int i = 0; i < words.Count; i++)
            {
                if (words[i].Substring(0, 2) == "19" || words[i].Substring(0, 2) == "20")
                {
                    infoIndexs.Add(i);
                }
            }

            for (int i = 0; i < infoIndexs.Count; i++)
            {
                var startIndex = infoIndexs[i];
                var endIndex = -1;
                if (i + 1 == infoIndexs.Count)
                {
                    endIndex = words.Count;
                }
                else
                {
                    endIndex = infoIndexs[i + 1];
                }
                var projectExperience = new ProjectExperience();


                for (int k = startIndex; k < endIndex; k++)
                {
                    var wordItem = (string)words[k];
                    if (wordItem.Substring(0, 2) == "19" || wordItem.Substring(0, 2) == "20")
                    {

                        var currWordItem = wordItem.Replace("~", "").Replace(".", "-").Replace("/", "-").Replace("\\", "-").Replace("至今", "").Replace("年", "-").Replace("月", "-").Replace("日", "-").Replace(" ", "");
                        var startIndex1 = 0;
                        var startIndex2 = 0;
                        //假设性判断第一个是开始时间
                        if (currWordItem.IndexOf("19") != -1)
                        {
                            startIndex1 = currWordItem.IndexOf("19");
                            startIndex2 = currWordItem.IndexOf("19", currWordItem.IndexOf("19") + 4);
                        }
                        else
                        {
                            startIndex1 = currWordItem.IndexOf("20");
                            startIndex2 = currWordItem.IndexOf("20", currWordItem.IndexOf("20") + 4);
                        }
                        if (startIndex2 == -1)
                        {
                            startIndex2 = wordItem.Count() - 2;
                        }
                        var StartDateArray = currWordItem.Substring(startIndex1, startIndex2).Split("-").ToList();
                        projectExperience.HireDate = GetData(StartDateArray);
                        var EndDateArray = currWordItem.Substring(startIndex2).Split("-").ToList();
                        projectExperience.DimissionDate = GetData(EndDateArray);
                    }
                    else
                    {
                        projectExperience.Description = projectExperience.Description + wordItem + "\n";
                    }


                }


                result.Add(projectExperience);
            }

            return result;
        }
        private static string GetData(List<string> currDateArray)
        {
            string currDate = "";
            if (currDateArray != null && currDateArray.Count() > 0)
            {
                var jsStartDateArray = currDateArray.Where(a => a.Length > 0).ToList();
                if (jsStartDateArray.Count() == 1)
                {
                    jsStartDateArray.Add("01");
                    jsStartDateArray.Add("01");
                    currDate = string.Join("-", jsStartDateArray);
                }
                else if (jsStartDateArray.Count() == 2)
                {
                    jsStartDateArray.Add("01");
                    currDate = string.Join("-", jsStartDateArray);
                }
                else if (jsStartDateArray.Count() > 2)
                {
                    var js3StartDateArray = new List<string>();
                    js3StartDateArray.Add(jsStartDateArray[0]);
                    js3StartDateArray.Add(jsStartDateArray[1]);
                    js3StartDateArray.Add(jsStartDateArray[2]);
                    currDate = string.Join("-", js3StartDateArray);
                }
            }

            return currDate;
        }

        private void JXLOG(string type, string info)
        {
            if (info.Length > 0)
            {
                //SQLHelp.Db.Ado.ExecuteCommand(string.Format(@"INSERT INTO [T_HR_ResumeIdentificationLog] ([Tpye],[Info])VALUES('{0}','{1}')", type, info));
            }
        }


        #endregion
    }
}